// import Nprogress from 'nprogress'
// import 'nprogress/nprogress.css'
import createRouter from './ssr-router'
import createStore from './ssr-store'
import {i18n, Vue, App} from '../src/main-conf'


export function createApp() {
    const router = createRouter()
    const store = createStore()
    const app = new Vue({
        router,
        store,
        i18n,
        render: h => h(App),
        mounted() {
            /* 路由守卫 */
            router.beforeEach((to, from, next) => {
                // if(to.path !== from.path) {
                //     Nprogress.start()
                // }
                next()
            })
            // router.afterEach((to, from) => {
            //     Nprogress.done()
            // })
        }
    })
    return { app, router, store }
}